package com.itheima.project.feign;

import com.itheima.project.basic.ResponseWrap;
import com.itheima.project.hystrix.DataDictHystrix;
import com.itheima.project.vo.dict.DataDictVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName DataDictFace.java
 * @Description：数字字典feign接口类
 */
@FeignClient(value = "module-dict-web",fallback = DataDictHystrix.class)
public interface DataDictFeign {

    /**
     * @Description 根据parentKey获取value
     * @return
     */
    @GetMapping("data-dict/parent-key/{parentKey}")
    ResponseWrap<List<DataDictVo>> findDataDictVoByParentKey(@PathVariable("parentKey") String parentKey);

    /**
     * @Description 根据dataKey获取DataDictVo
     * @return
     */
    @GetMapping("data-dict/data-key/{dataKey}")
    ResponseWrap<DataDictVo> findDataDictVoByDataKey(@PathVariable("dataKey")String dataKey) ;

    /**
     * @Description 根据dataKey获取DataDictVo集合
     * @return
     */
    @PostMapping("data-dict/findValueByDataKeys")
    ResponseWrap<List<DataDictVo>> findValueByDataKeys(@RequestBody ArrayList<String> dataKeys);

}
